var card1,card2,card3,licensePhoto,facadePhoto,needExamine = true;
$('.icon').click(function(){
	var iconkey = $(this).data('icon');
	switch(iconkey){
		case '#sfzz':
			$(iconkey).click();
			$(iconkey).change(function(){
			var file = $(iconkey)[0].files[0];
			var data = new FormData();
			data.append('userId', localStorage.userId);
			data.append('value', file);
			$.ajax({
				url: API.h5upload,
				data: data,
				type: 'post',
				dataType: 'json',
				contentType: false, 
				processData: false,
				beforeSend: function() {
					layer.open({type: 2});
				},
				success: function(res) {
					layer.closeAll();
					card1 = res.data[0].relativePath;
					$('#positive').children('img').attr('src',Host+card1);
					layer.open({ content: '图片上传成功',skin: 'msg',time: 2});
				},
				error: function() {
					layer.closeAll();
					layer.open({ content: '图片上传失败',skin: 'msg',time: 2});
				}
			});
			});
			break;
		case '#sfzf':
			$(iconkey).click();
			$(iconkey).change(function(){
			var file = $(iconkey)[0].files[0];
			var data = new FormData();
			data.append('userId', localStorage.userId);
			data.append('value', file);
			$.ajax({
				url: API.h5upload,
				data: data,
				type: 'post',
				dataType: 'json',
				contentType: false, 
				processData: false,
				beforeSend: function() {
					layer.open({type: 2});
				},
				success: function(res) {
					layer.closeAll();
					card2 = res.data[0].relativePath;
					$('#otherSide').children('img').attr('src',Host+card2);
					layer.open({ content: '图片上传成功',skin: 'msg',time: 2});
				},
				error: function() {
					layer.closeAll();
					layer.open({ content: '图片上传失败',skin: 'msg',time: 2});
				}
			});
			});
			break;
		case '#sfzsc':
			$(iconkey).click();
			$(iconkey).change(function(){
			var file = $(iconkey)[0].files[0];
			var data = new FormData();
			data.append('userId', localStorage.userId);
			data.append('value', file);
			$.ajax({
				url: API.h5upload,
				data: data,
				type: 'post',
				dataType: 'json',
				contentType: false, 
				processData: false,
				beforeSend: function() {
					layer.open({type: 2});
				},
				success: function(res) {
					layer.closeAll();
					card3 = res.data[0].relativePath;
					$('#hold').children('img').attr('src',Host+card3);
					layer.open({ content: '图片上传成功',skin: 'msg',time: 2});
				},
				error: function() {
					layer.closeAll();
					layer.open({ content: '图片上传失败',skin: 'msg',time: 2});
				}
			});
			});
			break;
		case '.yyzz':
			$(iconkey).click();
			$(iconkey).change(function(){
			var file = $(iconkey)[0].files[0];
			var data = new FormData();
			data.append('userId', localStorage.userId);
			data.append('value', file);
			$.ajax({
				url: API.h5upload,
				data: data,
				type: 'post',
				dataType: 'json',
				contentType: false, 
				processData: false,
				beforeSend: function() {
					layer.open({type: 2});
				},
				success: function(res) {
					layer.closeAll();
					licensePhoto = res.data[0].relativePath;
					$('#yyzz').children('img').attr('src',Host+licensePhoto);
					layer.open({ content: '图片上传成功',skin: 'msg',time: 2});
				},
				error: function() {
					layer.closeAll();
					layer.open({ content: '图片上传失败',skin: 'msg',time: 2});
				}
			});
			});
			break;
		case '.mtz':
			$(iconkey).click();
			$(iconkey).change(function(){
			var file = $(iconkey)[0].files[0];
			var data = new FormData();
			data.append('userId', localStorage.userId);
			data.append('value', file);
			$.ajax({
				url: API.h5upload,
				data: data,
				type: 'post',
				dataType: 'json',
				contentType: false, 
				processData: false,
				beforeSend: function() {
					layer.open({type: 2});
				},
				success: function(res) {
					layer.closeAll();
					facadePhoto = res.data[0].relativePath;
					$('#mtz').children('img').attr('src',Host+facadePhoto);
					layer.open({ content: '图片上传成功',skin: 'msg',time: 2});
				},
				error: function() {
					layer.closeAll();
					layer.open({ content: '图片上传失败',skin: 'msg',time: 2});
				}
			});
			});
			break;
	}
})


